package com.netx.cubigraf.apps.zipper;
import java.io.Writer;
import org.eclipse.swt.widgets.Text;


public class TextWidgetWriter extends Writer {

	private final Text _text;
	
	public TextWidgetWriter(Text text) {
		super();
		_text = text;
	}

	public void write(char[] chars, int off, int len) {
		write(new String(chars), off, len);
	}

	public void write(String s, int off, int len) {
		_text.append(s.substring(off, len-off));
	}

	public void write(char[] chars) {
		write(new String(chars));
	}

	public void write(String s) {
		// Dont reuse write(s, off, len) to 
		// avoid creating a substring.
		_text.append(s);
	}

	public void write(int c) {
		_text.append(new String(new char[] {(char)c}));
	}

	public void flush() {
	}

	public void close() {
		flush();
	}
}
